import type { prductType } from "@/types/product"
import { defineStore } from "pinia"
import type { PersistenceOptions } from "pinia-plugin-persistedstate"
import { ref } from "vue"

// 定义首页展示数据的 store
export const useProductTypeStore = defineStore(
  'productType',
  () => {
    // 商品类别列表
    const typeList = ref<prductType[]>([
    ])
    // 选中的商品分类 ID
    const selectedTypeId = ref<string>('')

    return { typeList, selectedTypeId }
  },
  {
    persist: {
      key: 'productTypeStore',
      paths: ['typeList'],
      storage: window.localStorage,
    } as PersistenceOptions,
  },
)
